package cn.juque.common.base;

import cn.juque.common.constants.BaseMessageEnum;
import lombok.Data;

import java.io.Serializable;

/**
 * @author nuoka
 */
@Data
public class BaseResponseVO<T> implements Serializable {

    private static final long serialVersionUID = -5025178370351984202L;

    private String code;

    private String msg;

    private T data;

    private PageInfo pageInfo;

    public BaseResponseVO() {

    }

    public BaseResponseVO(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public BaseResponseVO(String code, String msg, T data) {
        this(code, msg);
        this.data = data;
    }

    public BaseResponseVO(String code, String msg, T data, PageInfo pageInfo) {
        this(code, msg, data);
        this.pageInfo = pageInfo;
    }

    public BaseResponseVO(BaseMessageEnum msg, T data) {
        this(msg.getCode(), msg.getMsg(), data);
    }

  public BaseResponseVO(BaseMessageEnum msg, T data, PageInfo pageInfo) {
    this(msg.getCode(), msg.getMsg(), data, pageInfo);
  }
}
